package com.itheima.tanhua.dubbo.mappers;

import com.itheima.tanhua.model.domain.User;
import com.itheima.tanhua.model.domain.bto.LoginReginfobto;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserLoginMapper {
    @Select("select *from tb_user where mobile =#{phone}")
    User login(String phone);

    @Insert("insert into tb_user (password,mobile,created) values(#{password},#{mobile},#{created})")
    void addUser(User user);

    @Insert("insert into tb_user_info (gender,nickname,birthday,city,avatar,created,id) values (#{gender},#{nickname},#{birthday},#{city},#{header},#{created},#{id})")
    void addUseMsg(LoginReginfobto loginReginfobto);

    @Select("select id from tb_user where mobile=#{phone}")
    Long getId(String phone);


  @Update("update tb_user_info set avatar=#{avatar} where id=#{id}")
    void addUserMsgFilePath(@Param("avatar") String avatar, @Param("id") Long id);

  @Select("select id from tb_user_info where id=#{id}")
    Long tbuserinfoid(Long id);
}
